<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>

<script>
  function onSubmit(op,priceId){
	   document.getElementById('optioninfo').value=op;
	   document.getElementById('price_id').value=priceId;
      var form = document.getElementById('userForm');
        form.action = "{{ url('admin/goodspricelist') }}/" + op;
        form.submit();
      }
  function onSubmitDelete(op,priceId){
	   document.getElementById('optioninfo').value=op;
	   document.getElementById('price_id').value=priceId;
	   if (false === confirm('削除しますか？') )return;

      var form = document.getElementById('userForm');
        form.action = "{{ url('admin/goodspricelist') }}/"+op;
        form.submit();
      }
  function onSubmitCsv(op,price_id){
	   document.getElementById('optioninfo').value=op;
	   document.getElementById('price_id').value=price_id;

   		var form = document.getElementById('userForm');
       form.action = "{{ url('admin/goodspricelist') }}/"+op;
       form.submit();
 }
  </script>
</head>
@extends('layouts.admin_common') @section('content')
<div class="breadcrumbs_container">
	{{Breadcrumbs::render('admin.goods_price') }}</div>
<div class="system_tab_line"></div>
<body>
	<div id="outDiv">

		<table class="table table-condensed">
			<tr>
				<td>商品グループ</td>
				<td>仕切設定</td>
				<td>仕切価格</td>
				<td>会社名</td>
				<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
			</tr>
			@foreach ($priceData as $price)


			<tr>
				<td>{{$price->goods_name}}</td>
				<td>{{$price->invoice_rate}}</td>
				<td>{{$price->invoice_price}}</td>
				<td>{{$price->corp_name}}</td>
				<td><input type="button" value="修正"
					class="btn btn-primary button_normal"
					onclick="onSubmit('create','{{$price->goods_price_id}}')" /> <input
					type="button" value="削除" class="btn btn-primary button_normal"
					onclick="onSubmitDelete('delete','{{$price->goods_price_id}}')"></td>
			</tr>
			@endforeach
		</table>

		<form class="form-inline" id="userForm" method="post"
			enctype="multipart/form-data">

			<table border="0" cellspacing="0" style="width: 1300px;">
				<tr>
					<td align="right"><input type="button" value="新規"
						class="pure-button pure-button-primary button_normal"
						onclick="onSubmit('create','')" /></td>

					<td align="right" style="width: 10px;"><label for="sample1"
						class="btn btn-primary button_normal">Csv取込 <input type="file"
							name="csv_file" id="sample1" style="display: none;"
							class="btn btn-primary button_normal"
							onChange="onSubmitCsv('inputCsv','')" />
					</label></td>
				</tr>

			</table>
			<div>@if(isset($success)) {{$success}} @endif</div>
			<div>@if(isset($error)) {{$error}} @endif</div>
			<input type="hidden" id="price_id" name="price_id"> <input
				type="hidden" id="optioninfo" name="optioninfo"> <input
				type="hidden" name="_token" value="{{csrf_token()}}">
		</form>
	</div>
</body>
</html>
@endsection
